package cn.shenshen.shop.service.impl;

import cn.shenshen.shop.domain.SeckillOrder;
import cn.shenshen.shop.mapper.SeckillOrderMapper;
import cn.shenshen.shop.service.ISeckillOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SeckillOrderService implements ISeckillOrderService {

    @Autowired
    private SeckillOrderMapper seckillOrderMapper;

    public SeckillOrder find(Long userId, Long goodId) {

        return seckillOrderMapper.find(userId,goodId);
    }


    public void createSeckillOrder(Long userId, Long goodId, String orderNo) {
        SeckillOrder seckillOrder = new SeckillOrder();
        seckillOrder.setGoodId(goodId);
        seckillOrder.setOrderNo(orderNo);
        seckillOrder.setUserId(userId);
        seckillOrderMapper.insert(seckillOrder);
    }
}
